package com.cloud.feign;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 奶茶
 */
@SpringBootApplication
//@EnableDiscoveryClient
@EnableFeignClients
//必须加
@EnableHystrixDashboard
//fegin一定不能少@EnableCircuitBreaker，少这个会报Unable to connect to Command Metric Stream错误
@EnableCircuitBreaker
@RestController
public class CloudConsumerFeignApplication {

	public static void main(String[] args) {
		SpringApplication.run(CloudConsumerFeignApplication.class, args);
	}

	@Value("${server.port}")
	String port;

	@RequestMapping("/sayHelloFeign")
	public String hi(@RequestParam String name){
		return "hi "+name+",i am from port:" +port;
	}


}
